package com.software.graduationproject.modules.area.entity;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;

/**
 * SysArea : 重庆行政编码
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_area")
@ApiModel(value = "SysArea", description = "重庆行政编码")
public class SysArea extends BaseModel<SysArea> {

    @TableField(value ="up_id")
    @ExcelProperty(value = "上级ID")
    @ApiModelProperty(value = "上级ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "上级ID不能为空")
    private Long upId;

    @TableField(value ="name")
    @ExcelProperty(value = "区域名称")
    @ApiModelProperty(value = "区域名称")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "区域名称不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 48, message = "区域名称长度不能超过48")
    private String name;

    @TableField(value ="name_pinyin")
    @ExcelProperty(value = "用户姓名拼音")
    @ApiModelProperty(value = "用户姓名拼音")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户姓名拼音不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "用户姓名拼音长度不能超过255")
    private String namePinyin;

    @TableField(value ="code")
    @ExcelProperty(value = "区域编码")
    @ApiModelProperty(value = "区域编码")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "区域编码不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 12, message = "区域编码长度不能超过12")
    private String code;

    @TableField(value ="up_area_codes")
    @ExcelProperty(value = "行政区划编码集合")
    @ApiModelProperty(value = "行政区划编码集合")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "行政区划编码集合不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "行政区划编码集合长度不能超过255")
    private String upAreaCodes;

    @TableField(value ="type")
    @ExcelProperty(value = "层级标识(1 省, 2 市, 3 县)")
    @ApiModelProperty(value = "层级标识(1 省, 2 市, 3 县)")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "层级标识(1 省, 2 市, 3 县)不能为空")
    private Integer type;

}
